package se_test;

import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) {
        int n = 10;
        int count = 0;
        while(n != 0){
            n = n & (n - 1);
            count++;
        }
        System.out.println(count);
    }
    public static void main6(String[] args) {
        int a = 48;
        int b = 36;
        int c = a % b;
        while(c != 0){
            a = b;
            b = c;
            c = a % b;
        }
        System.out.println(b);
    }
    public static void main5(String[] args) {
        double sum = 0;
        int flag = 1;
        for (int i = 1; i <= 100; i++) {
            sum = sum + (1.0/i) * flag;
            flag = -flag;
        }
        System.out.println(sum);
    }
    public static void main4(String[] args) {
        for (int i = 0; i < 1000; i++) {
            int count = 0;
            int tmp = i;
            while(tmp != 0){
                count++;
                tmp /= 10;
            }
            tmp = i;
            int sum = 0;
            while(tmp != 0){
                sum += Math.pow(tmp % 10,count);
                tmp /= 10;
            }
            if(sum == i) {
                System.out.println(i);
            }
        }
    }
    public static void main3(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while(scanner.hasNextInt()){
            int n = scanner.nextInt();
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    if(i == j || i + j ==(n - 1)){
                        System.out.print("*");
                    }else{
                        System.out.print(" ");
                    }
                }
                System.out.println();
            }
        }
    }
    public static void main2(String[] args) {
        System.out.println("请输入一个数：");
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        boolean flag = true;
        if(n == 1){
            flag = false;
        }else{
            for(int i = 2;i < n;i++){
                if(n % i == 0){
                    flag = false;
                    break;
                }
            }
        }
        if(flag){
            System.out.println(n + "是素数");
        }else{
            System.out.println(n + "不是素数");
        }
    }
    public static void main1(String[] args) {
        int count = 0;
        for (int i = 1; i <= 100; i++) {
            if(i % 10 == 9){
                count++;
            }
            if (i / 10 == 9) {
                count++;
            }
        }
        System.out.println(count);
    }
}
